package com.zsj.zsjkotlinmvvm.data.repository

import com.zsj.zsjkotlinmvvm.data.model.repository.RepositoryData
import com.zsj.zsjkotlinmvvm.data.remote.repository.RepositoryRemoteDataSource
import com.zsj.zsjkotlinmvvm.utils.Language
import java.time.LocalDateTime
import javax.inject.Inject

/**
 * Created by TanJiaJun on 2020-02-08.
 */
class GitHubRepository @Inject constructor(
        private val remoteDataSource: RepositoryRemoteDataSource
) {

    fun getDefaultLanguageNames(): List<String> =
            listOf(
                    Language.KOTLIN.languageName,
                    Language.VIDEO.languageName
            )


    suspend fun getRepositories(languageName: String): List<RepositoryData> =
            remoteDataSource.fetchRepositories(
                    languageName = languageName,
                    fromDateTime = LocalDateTime.now().minusMonths(1)
            )

}